package com.monika.main.system.controller;

import com.monika.main.system.constant.Constant;
import com.monika.main.system.domain.AjaxResult;
import com.monika.main.system.domain.entity.LoginBody;
import com.monika.main.system.servcie.SysLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Author whh
 * Date 2023/04/17/ 21:03
 * <p></p>
 */
@RestController
@RequestMapping("/user")
public class SysLoginController {


    @Autowired
    private SysLoginService sysLoginService;

    @PostMapping("/login")
    public AjaxResult login(LoginBody loginBody) {
        // 生成令牌
        sysLoginService.login(loginBody.getUsername(), loginBody.getPassword());
        return AjaxResult.success(loginBody.getUsername()+"登陆成功");
    }



    @PostMapping("/register")
    public void register()  {
        System.out.println("register");
    }
}
